package br.com.peperoncino.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="TBLCLI")
@SuppressWarnings("serial")
public class Cliente implements Serializable{
	
	@Id
	@Column(name="CODCLI")
	private Integer id;
	
	@Column(name="NOMCLI", nullable=false, length = 100)
	private String nome;
	
	@Temporal(TemporalType.DATE)
	@Column(name="DATCLI", nullable=false)
	private Date dataCadastroCliente;
	
	@OneToMany(mappedBy = "cliente", fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	private Set<ClienteEndereco> enderecos;
	
	@OneToMany(mappedBy = "cliente", fetch = FetchType.LAZY, cascade = CascadeType.REFRESH)
	private Set<ClienteTelefone> telefones;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNome() {
		return nome;
	}

	public void setNome(String nome) {
		this.nome = nome;
	}

	public Date getDataCadastroCliente() {
		return dataCadastroCliente;
	}

	public void setDataCadastroCliente(Date dataCadastroCliente) {
		this.dataCadastroCliente = dataCadastroCliente;
	}
	
	public Set<ClienteEndereco> getEnderecos() {
		return enderecos;
	}

	public void setEnderecos(Set<ClienteEndereco> enderecos) {
		this.enderecos = enderecos;
	}

	public Set<ClienteTelefone> getTelefones() {
		return telefones;
	}

	public void setTelefones(Set<ClienteTelefone> telefones) {
		this.telefones = telefones;
	}
}